package com.qubuyer.ext

import android.graphics.Paint
import android.graphics.drawable.Drawable
import android.widget.ImageView
import android.widget.TextView
import androidx.databinding.BindingAdapter
import com.bumptech.glide.Glide

@BindingAdapter("android:placeholder", "android:imgUrl")
fun loadImage(view: ImageView, placeholder: Drawable, imgUrl: String?) {
    Glide.with(view.context).load(imgUrl).placeholder(placeholder).error(placeholder).into(view)
}

@BindingAdapter("android:delLine")
fun setDelLine(view: TextView, delLine: Boolean) {
    if (delLine)
        view.paint.flags = Paint.STRIKE_THRU_TEXT_FLAG
}